package org.jeecg.modules.bigdatashow.controller;

import org.jeecg.modules.bigdatashow.entity.*;
import org.jeecg.modules.bigdatashow.service.TakeOrderService;
import org.jeecg.modules.bigdatashow.utils.JsonBack;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.ArrayList;
import java.util.Date;
import java.util.List;


/**
 * @Description: TODO
 * @author: scott
 * @date: 2022年03月04日 10:20
 */
@CrossOrigin
@RestController
@RequestMapping(value="/takeOutOrder",produces="application/json; charset=utf-8")
public class TakeOrderController {
    @Autowired
    TakeOrderService takeOrderService;

    /*查询所有的订单的信息*/
    @GetMapping("/findAllTakeOrders")
    public JsonBack findAllTakeOrders()
    {
        List<TakeOrder> takeOrderList = takeOrderService.findAllTakeOrders();
        if(takeOrderList != null)
        {
            return new JsonBack(200,"查询成功",takeOrderList);
        }else{
            return new JsonBack(404,"未查询到数据");
        }
    }
    /*查询一月份每日订单数量*/
    @GetMapping("/findDailyOrderQuantityInJanuary")
    public JsonBack findDailyOrderQuantityInJanuary()
    {
        List<DailyOrderQuantityInJanuary> dailyOrderQuantityInJanuaryList= takeOrderService.findDailyOrderQuantityInJanuary();
        if(dailyOrderQuantityInJanuaryList != null)
        {
            return new JsonBack(200,"查询成功",dailyOrderQuantityInJanuaryList);
        }else{
            return new JsonBack(404,"未查询到数据");
        }
    }

    /*查询每月的订单数与退单数*/
    @GetMapping("/findEveryMonthOrderAmountAndReturnAmount")
    public JsonBack findEveryMonthOrderAmountAndReturnAmount()
    {
        List<EveryMonthOrderAmountAndReturnAmount> everyMonthOrderAmountAndReturnAmountList= takeOrderService.findEveryMonthOrderAmountAndReturnAmount();
        if(everyMonthOrderAmountAndReturnAmountList != null)
        {
            return new JsonBack(200,"查询成功",everyMonthOrderAmountAndReturnAmountList);
        }else{
            return new JsonBack(404,"未查询到数据");
        }
    }
    /*查询每月的订单数*/
    @GetMapping("/findEveryMonthOrderAmount")
    public JsonBack findEveryMonthOrderAmount()
    {
        List<EveryMonthOrderAmount> everyMonthOrderAmountList= takeOrderService.findEveryMonthOrderAmount();
        if(everyMonthOrderAmountList != null)
        {
            return new JsonBack(200,"查询成功",everyMonthOrderAmountList);
        }else{
            return new JsonBack(404,"未查询到数据");
        }
    }
    /*查询每种套餐的订单数*/
    @GetMapping("/findEveryOrderTypeAmount")
    public JsonBack findEveryOrderTypeAmount()
    {
        List<EveryOrderTypeAmount> everyOrderTypeAmountList= takeOrderService.findEveryOrderTypeAmount();
        if(everyOrderTypeAmountList != null)
        {
            return new JsonBack(200,"查询成功",everyOrderTypeAmountList);
        }else{
            return new JsonBack(404,"未查询到数据");
        }
    }

    /*查询每个季节的订单数*/
    @GetMapping("/findEverySeasonOrderAmount")
    public JsonBack findEverySeasonOrderAmount()
    {
        EverySeasonOrderAmount everySeasonOrderAmount= takeOrderService.findEverySeasonOrderAmount();
        if(everySeasonOrderAmount != null)
        {
            return new JsonBack(200,"查询成功",everySeasonOrderAmount);
        }else{
            return new JsonBack(404,"未查询到数据");
        }
    }


    /*查询一周中各周堵车的订单与畅通的订单*/
    @GetMapping("/findEveryWeekOrderTrafficAmount")
    public JsonBack findEveryWeekOrderTrafficAmount()
    {
        List<EveryWeekOrderTrafficAmount> everyWeekOrderTrafficAmountList= takeOrderService.findEveryWeekOrderTrafficAmount();
        if(everyWeekOrderTrafficAmountList != null)
        {
            return new JsonBack(200,"查询成功",everyWeekOrderTrafficAmountList);
        }else{
            return new JsonBack(404,"未查询到数据");
        }
    }






}
